#include "helper/sqlite/IResult.h"

#include <sstream>
#include "helper/sqlite/Error.h"

namespace helper {
namespace sqlite {

// -1 = ERROR
// 0 = DONE, 
// 1 = ROW
int IResult::fetchCode() const{
  switch(error::sqlite_error(_ec.value())){
    case error::sqlite_error::done: return  0;
    case error::sqlite_error::row : return  1;
    default         : return -1;
  }
}


std::string IResult::what() const {
  std::ostringstream oss;
  oss << "code:" << _ec.value() << " Msg:" << _ec.message();
  return oss.str();
}

}//namespace sqlite
}//namespace helper
